package com.lc.controller;

import com.lc.annotation.MyController;
import com.lc.annotation.MyRequestMapping;
import com.lc.annotation.MyRequestParam;
import com.lc.annotation.MyResource;
import com.lc.service.TestService;
import com.lc.util.MyRequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by lichao on 2017/12/29.
 */
@MyController
@MyRequestMapping(value = "test")
public class TestController {

    @MyResource(name = "testServiceImpl")
    private TestService testService;

    @MyRequestMapping(value = "/get",method = MyRequestMethod.POST)
    public String getData(@MyRequestParam(value = "name")String name , String age){
        System.out.println(testService.getData(name,age));
        return "index";
    }

    @MyRequestMapping(value = "/del",method = MyRequestMethod.GET)
    public String delData(){
        testService.delData();
        return "index";
    }

    @MyRequestMapping(value = "/upd",method = MyRequestMethod.POST)
    public void updData(HttpServletRequest request , HttpServletResponse response){
        testService.updData();
    }

}
